<template>
  <div class="app-container">
    <el-tabs v-model="tabsValue">

      <el-tab-pane :name="item.id" v-for="(item , index) in tabList" :key="item.id">
        <template slot="label">
          <el-badge :value="item.MessagesNumber">
            <span style="padding: 0 10px;">{{ item.title }}</span>
          </el-badge>
        </template>
      </el-tab-pane>

    </el-tabs>

    <el-form ref="form" :model="query" label-width="80px" :inline="true">
      <el-form-item label="申请号">
        <el-input v-model="query.id"></el-input>
      </el-form-item>
      <el-form-item label-width="0px">
        <el-button type="primary" round>查询</el-button>
      </el-form-item>
    </el-form>

    <component :is="tabsValue"/>

  </div>
</template>

<script>

import toBePaid from './components/toBePaid'
import pendingAcceptance from './components/pendingAcceptance'
import completed from './components/completed'
import processing from './components/processing'
import rejected from './components/rejected'
import unclaimed from './components/unclaimed'

export default {
  // import 引入的组件需要注入到对象中才能使用
  components: { toBePaid, pendingAcceptance, completed, processing, rejected, unclaimed },
  props: {},
  data() {
    // 这里存放数据
    return {
      tabsValue: 'toBePaid',
      query: {
        id: ''
      },
      tabList: [
        {
          id: 'toBePaid',
          title: '待支付',
          MessagesNumber: 1
        }, {
          id: 'pendingAcceptance',
          title: '待受理',
          MessagesNumber: 1
        },
        {
          id: 'processing',
          title: '办理中',
          MessagesNumber: 1
        },
        {
          id: 'unclaimed',
          title: '待领取',
          MessagesNumber: 1
        },
        {
          id: 'completed',
          title: '已完成',
          MessagesNumber: 1
        },
        {
          id: 'rejected',
          title: '已拒绝',
          MessagesNumber: 1
        }
      ]
    }
  },
  // 计算属性 类似于 data 概念
  computed: {},
  // 监控 data 中的数据变化
  watch: {},
  // 生命周期 - 创建完成（可以访问当前this 实例）
  created() {
  },
  // 生命周期 - 挂载完成（可以访问 DOM 元素）
  mounted() {
  },
  beforeCreate() {
  },
  beforeMount() {
  }, // 生命周期 - 挂载之前
  beforeUpdate() {
  }, // 生命周期 - 更新之前
  updated() {
  }, // 生命周期 - 更新之后
  beforeDestroy() {
  }, // 生命周期 - 销毁之前
  destroyed() {
  }, // 生命周期 - 销毁完成
  activated() {
  },
  // 方法集合
  methods: {} // 如果页面有 keep-alive 缓存功能,这个函数会触发
}
</script>

<style scoped lang="scss">
::v-deep .el-tabs {
  .el-tabs__item {
    height: 50px;
    line-height: 50px;
  }

  .el-badge__content.is-fixed {
    top: 9px;
  }

}
</style>

